package com.tz.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 16-10-9.
 */
@Component//当前类是组件
public class ClassA {

   // @Autowired//依赖注入
    private ClassB b;
   // @Autowired//依赖注入
    private InterfaceC i;
    //@Autowired//依赖注入
    private ClassD d;

    public ClassA() {
    }
    @Autowired
    public ClassA(ClassB b, InterfaceC i, ClassD d) {
        this.b = b;
        this.i = i;
        this.d = d;
    }

    public void a(){
        System.out.println("执行a()");
        b.b();
        i.i();
        d.d();
    }
}
